<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
if($_RQ['op']=='main'){
	$id=$_RQ['id'];
	if(!$id){
		exi('请选择商品','error','jy_bargain/index/list');
	}
	$basic=$this->plugin_setting('basic');
	$list = pdo_get('jy_bargain_goods',array('id'=>$id));
	$good=pdo_get('jy_weishop_goods',array('id'=>$list['goods_id']),array('image','images','price','title','subtitle','total','content'));
	$list['status']=0;
	if($list['start_time']>time()){
		$list['status']=1;
	}
	if($list['end_time']<time()){
		$list['status']=2;
	}
	if($good['total']<1){
		$list['status']=3;
	}
	$list['image']=$good['image'];
	$list['images']=json_decode($good['images'],true);
	$list['content']=htmlspecialchars_decode($good['content']);
	$list['price']=$good['price'];
	$list['title']=$good['title'];
	$list['title2']=$good['subtitle']?:'无商品描述！';
	$list['end_timedown']=model('jy_weishop/model')->date($list['end_time']-TIMESTAMP);
	$return['res']=$list;
	$return['basic']=$basic;
	$return['endtime']=date('Y-m-d H:i:s',$list['end_time']);
	$return['sharedata']=array(
			'title'=>$good['title']?$good['title'].'-砍价':'砍价详情',
			'desc'=>$good['subtitle']?$good['subtitle']:'砍价详情-在线拼团商城！',
			'link'=>custom_url('jy_bargain/detail//id='.$id.'&fromuser='.$_SESSION['uid'],true),
			'imgUrl'=>tomedia($good['image'])
	);
	set_html('title',$good['title']?:'砍价详情');
	exi($return);
}